<?php

class Dao_SessionModel extends Dao_BaseModel {

    protected $_table = 'usersession';

    public function __construct ()
    {
        parent::__construct ();
    }

    public function addSession ($data)
    {   
        $res = parent::add ( $data );
        return $res;
    }

    public function editSession ($uid , $sessionid)
    {
        
        $cond[] = array ( 'ss_uid' , $uid );
        $data = array ( 'ss_session' => $sessionid );
        $res = parent::edit ( $data , $cond );
        return $res;
    }

    public function get ($uid,$sessionid)
    {
        $where   = array ();
        $where[] = array ( 'ss_uid' , $uid );
        if($sessionid){
            $where[] = array('ss_session',$sessionid);
        }
        return parent::getOne ( array ( 'ss_uid' , 'ss_session' ) , $where );
    }

}
